<?php

//创建http服务
$http = new Swoole\Http\Server('0.0.0.0',8010);

//设置http静态资源目录
$http->set([
	'enable_static_handler'=>true,
	'document_root'=>'/home/wwwroot/swoole_demo/static'
]);

//监听http请求
$http->on('request',function($request,$response){
	$param = $request->get;
	$response->header("Content-Type", "text/html; charset=utf-8");
	$response->end("<h1>http</h2>".json_encode($param));
});

//启动服务
$http->start();